<template>
	<view class="mask">
		<view
			style="position: absolute;left: 50%;top: 50%;background: #fff;border-radius: 30rpx;transform: translate(-50%,-50%);">
			<view style="width: 500rpx;position: relative;">
				<view style="position: absolute;top: -20rpx;right: 0;">
					<image src="../../static/update.png" style="width: 200rpx;height: 200rpx;" mode="aspectFit">
					</image>
				</view>
				<view
					style="height: 200rpx;width: 100%;background:linear-gradient(to bottom, rgba(3, 200, 212,1), rgba(3, 200, 212,0));padding:40rpx 30rpx;overflow: hidden;border-radius:30rpx 30rpx 0 0;">
					<view style="font-size: 40rpx;font-weight: bold;color:#333">发现新版本</view>
					<view style="display: flex;margin-top: 10rpx;">
						<view
							style="background: rgb(3, 200, 212);font-size: 25rpx;border-radius: 10rpx;padding:5rpx 10rpx;color: #fff;">
							Version：{{ver}}</view>
					</view>
				</view>

				<view style="padding: 30rpx;display: flex;">
					<uv-button text="暂不" shape="circle" size='small' :custom-style="{width:'35%','flex-shrink':0}"
						@click="back" color="#ccc"></uv-button>
					<view style="width: 30rpx;flex-shrink: 0;"></view>
					<uv-button text="前 往 更 新" shape="circle" size='small' @click="toDownUrl"
						color="linear-gradient(to right, rgb(3, 200, 212), rgb(3, 200, 212))"></uv-button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import api from '@/static/api.js'
	export default {
		data() {
			return {
				ver:''
			}
		},
		onLoad(e) {
			this.ver=e.ver
			console.log('update',e)
		},
		methods: {
			back() {
				uni.navigateBack()
			},
			toDownUrl() {
				uni.showLoading({
					title: '正在跳转'
				});
				api.configGet({
					key: 'versionUrl'
				}).then(res => {
					uni.hideLoading();
					// if(parseInt(res.data.data) > plus.runtime)
					plus.runtime.openURL(res.data.data)
				})
			}
		}
	}
</script>

<style>
	page {
		background: transparent;
	}

	.mask {
		position: fixed;
		left: 0;
		top: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.4);
	}
</style>